package com.rabbiter.common;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum ResultCodeNum {

    SUCCESS("200","成功"),
    FAIL("500","失败");

    public final String code;

    public final String msg;

    ResultCodeNum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResultCodeNum getResultCode(String code) {
        for (ResultCodeNum codeNum: ResultCodeNum.values()) {
            if(Objects.equals(codeNum.code, code)) {
                return codeNum;
            }
        }
        return null;
    }

}